package com.tarena.lbs.coupon.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tarena.lbs.coupon.pojo.po.CouponStockPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface StockMapper  extends BaseMapper<CouponStockPO> {
    @Update("UPDATE coupon_stock SET num=#{num}")
    CouponStockPO updateStock(Integer id) ;

    @Select("SELECT num FROM coupon_stock WHERE coupon_id=#{couponId}")
    Integer selectNumById(Integer couponId);
    @Update("UPDATE coupon_stock SET num=#{num}")
    Boolean couponMinusOne(Integer num);
    @Select("SELECT num FROM coupon_stock WHERE coupon_id=#{id}")
    Integer selectByCouponId(Integer id);
}
